﻿using System;
using ControleRepresentante.Data.Catalogs;

namespace ControleRepresentante.Data.CatalogSteps
{
    internal abstract class CatalogStepBase<TStepType> : ICatalogStep
    {
        protected CatalogStepBase()
        {
            if (!(typeof(TStepType).IsEnum))
            {
                throw new Exception("TStepType must be Enum");
            }
        }

        protected abstract TStepType CatalogStepType { get; }
        
        public string Name
        {
            get { return CatalogStepType.ToString(); }
        }

        public long Id
        {
            get { return (int) Enum.Parse(typeof(TStepType), Name); }
        }

        public abstract void Execute(IDataAccess dataAccess);
    }
}